package net.dntuan.training.spring.integration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.endpoint.EventDrivenConsumer;

public class ErrorMessageServiceActivator {

  @Autowired
  private EventDrivenConsumer uppercaseServiceActivator;

  public Result processError(Message msg) {
    Result result = new Result();
    if (uppercaseServiceActivator.isRunning()) {
      result.setContent("Content is not accepted. Content must start with the letter 'h'");
    } else {
      result.setContent("service is down now. please try again later");
    }
    return result;
  }
}
